<?php
class Links extends CActiveRecord{
	
	public static function model($className = __CLASS__){
		return parent::model($className);
	}
	
	public function tableName(){
		return '{{links}}';
	}
	
	public function attributeLabels(){
		return array(
				'links_name'=>'链接名称',
				'links_url'=>'url',
				'sort'=>'排序'
		);
	}
	
	public function rules(){
		return array(
				array('links_name', 'required', 'message'=>'链接名称不能为空'),
				array('links_url', 'required', 'message'=>'url不能为空'),
				array('sort', 'numerical', 'message'=>'排序必须为数字')
		);
	}
	
	/**
	 * 获取友情链接
	 */
	public function getLinks(){
		return $this->findAll();
	}
}